home *** CD-ROM | disk | FTP | other *** search
- /*
- File: AbstractSearchSpec.h
-
- Contains: xxx put contents here xxx
-
- Written by: Andy Nicholas, Greg Anderson, Tom Conrad, Chris Bingham, Georgiann Puckett, John Thompson-Rohrlich
-
- Copyright: © 1994-1995 by Apple Computer, Inc., all rights reserved.
-
- <10> 9/18/95 ga
-
- */
-
- #ifndef AbstractSearchSpec_h
- #define AbstractSearchSpec_h
-
- //
- // MoreAEM.h is needed because methods defined in this
- // file take TDescriptors as pass-by-value parameters,
- // which requires the complete definition of the class
- // TDescriptor.
- //
- #include "MoreAEM.h"
-
- //
- // Object.h is needed because TObject is the base class of
- // TAbstractSearchSpec, and for the DeclareSmallClassData macros.
- //
- #include "Object.h"
-
- //
- // For 'cObject'
- //
- #include <AERegistry.h>
-
- //
- // An object of class TAbstractScriptableObject is passed to TAbstractSearchSpec::Compare
- // to determine if the object is within the search set.
- //
- class TAbstractScriptableObject;
- template <class T> class AListOf;
-
- //
- // Each specific search specification must be able to create a
- // search engine to search over the search space that the specification
- // covers.
- //
- class TAbstractSearchEngine;
- class TSearchEngineList;
- class TAETransaction;
-
- class TAbstractCollector;
- class TComparisonOperand;
-
- //========================================================================================
- //
- // CLASS TAbstractSearchSpec
- //
- // An object derived from TAbstractSearchSpec specifies some
- // criterion for searching some specific namespace.
- //
- //========================================================================================
-
- class TAbstractSearchSpec : public TObject
- {
- //
- // --- Methods -------------------------------------------------------------------------------------
- //
- public:
- DeclareSmallClassData(TAbstractSearchSpec, TObject);
-
- TAbstractSearchSpec() {};
-
- // Methods relating to the use of the search specification
-
- virtual void AccessBySearchSpec(const TAETransaction& t, TAbstractCollector* collector, DescType desiredClass, TAbstractScriptableObject* objectToSearch);
- virtual Boolean Compare(const TAETransaction& t, TAbstractScriptableObject* itemToTest) = 0;
-
- // Methods relating to the contents of this search specification
-
- virtual DescType SpecificationOperator();
- virtual long NumberOfSubterms();
- virtual TAbstractSearchSpec* SpecificationForTerm(long term);
- virtual TDescriptor BuildWhoseTest();
- TDescriptor BuildObjectSpecifier(DescType desiredClass, TDescriptor rootOfSearch);
-
- // Only used by comparison specifications
-
- virtual TComparisonOperand* GetRightHandComparisonOperand();
- virtual TComparisonOperand* GetLeftHandComparisonOperand();
-
- // Used to build up specifications from scratch
-
- virtual TAbstractSearchSpec* AddTermToSpecification(TAbstractSearchSpec* newSpecification);
-
- // Methods relating to the actual search
-
- virtual TAbstractSearchEngine* CreateSearchEngine();
- virtual void CreateSearchEngines(TSearchEngineList* searchEngines, TAbstractScriptableObject* requestor);
- virtual Boolean ShouldSearch (TAbstractScriptableObject* searchDisk);
- };
-
-
-
- //========================================================================================
- //
- // CLASS TLogicalSearchSpec
- //
- // A logical search specification contains a list of abstract search
- // specifications, and either ANDs or ORs them together.
- //
- //========================================================================================
-
- class TLogicalSearchSpec : public TAbstractSearchSpec
- {
- protected:
- AListOf<TAbstractSearchSpec*>* fListOfLogicalTerms;
- DescType fLogicalOperator;
-
- public:
- DeclareSmallClassData(TLogicalSearchSpec, TAbstractSearchSpec);
-
- TLogicalSearchSpec() : fListOfLogicalTerms(nil), fLogicalOperator(typeNull) {};
- TLogicalSearchSpec(DescType logicalOperator, AListOf<TAbstractSearchSpec*>* list) : fListOfLogicalTerms(list), fLogicalOperator(logicalOperator) {};
- virtual ~TLogicalSearchSpec();
-
- // Methods relating to the contents of this search specification
-
- virtual DescType SpecificationOperator();
- virtual long NumberOfSubterms();
- virtual TAbstractSearchSpec* SpecificationForTerm(long term);
-
- // Methods relating to the use of the search specification
-
- virtual Boolean Compare(const TAETransaction& t, TAbstractScriptableObject* itemToTest);
-
- // Methods relating to creating object specifiers for this search specification
-
- virtual TDescriptor BuildWhoseTest();
- virtual TAbstractSearchSpec* AddTermToSpecification(TAbstractSearchSpec* newSpecification);
-
- };
-
- #endif
-